package com.daydayup.learn;

import java.util.concurrent.atomic.AtomicReference;

public class TestAtomic {

    public static void main(String[] args) {
        AtomicReference<User> atomicUser = new AtomicReference<>();
        User zs  = new User("张三",22);
        User ls = new User("李四",23);
        atomicUser.set(zs);
        System.out.println(atomicUser.compareAndSet(ls, zs)+"\t"+atomicUser.get().toString());
    }

}
